package com.lzy.concertticket.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;

/**
 * 票区信息表
 * @TableName tb_ticket_zone
 */
@TableName(value ="tb_ticket_zone")
@Data
public class TicketZoneEntity extends BaseEntity implements Serializable {
    /**
     * 票区ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 演唱会ID
     */
    private Long concertId;

    /**
     * 区域名称
     */
    private String zoneName;

    /**
     * 价格
     */
    private BigDecimal price;

    /**
     * 总座位数
     */
    private Integer totalSeats;

    /**
     * 可用座位数/剩余座位数
     */
    private Integer availableSeats;

    /**
     * 区域描述
     */
    private String description;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TicketZoneEntity other = (TicketZoneEntity) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getConcertId() == null ? other.getConcertId() == null : this.getConcertId().equals(other.getConcertId()))
            && (this.getZoneName() == null ? other.getZoneName() == null : this.getZoneName().equals(other.getZoneName()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getTotalSeats() == null ? other.getTotalSeats() == null : this.getTotalSeats().equals(other.getTotalSeats()))
            && (this.getAvailableSeats() == null ? other.getAvailableSeats() == null : this.getAvailableSeats().equals(other.getAvailableSeats()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getConcertId() == null) ? 0 : getConcertId().hashCode());
        result = prime * result + ((getZoneName() == null) ? 0 : getZoneName().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getTotalSeats() == null) ? 0 : getTotalSeats().hashCode());
        result = prime * result + ((getAvailableSeats() == null) ? 0 : getAvailableSeats().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", concertId=").append(concertId);
        sb.append(", zoneName=").append(zoneName);
        sb.append(", price=").append(price);
        sb.append(", totalSeats=").append(totalSeats);
        sb.append(", availableSeats=").append(availableSeats);
        sb.append(", description=").append(description);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}